﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using com.woodsoft.core;
using EQ1.Elements;
using com.woodsoft.core.Files;
using EQ1.Objects;

namespace EQ1.Controls {
  public class HorizontalLayoutBox : LayoutBox , IUIElement<HorizontalLayoutBox> {
    public HorizontalLayoutBox ( UIDocument doc , string name )
      : base( doc , name ) {
      this.Style_Dividers = true;
    }
    public HorizontalLayoutBox ( UIDocument doc )
      : this( doc , "HorizontalLayoutBox" ) {
    }

    #region IUIElement<HorizontalLayoutBox> Members

    public void Validate ( HorizontalLayoutBox val , string name ) {
      UIClass par = ( UIClass ) this.ParentNode;

      if( val.LocalName != name ) {
        HorizontalLayoutBox el = new HorizontalLayoutBox( ( UIDocument ) val.OwnerDocument , name );
        el.Copy( val );
        val = el;
      }

      if( par.GetElement( name ) != null )
        par.RemoveElement( name );

      par.AppendChild( val );
    }

    public void Copy ( HorizontalLayoutBox val ) {
      base.Copy( val );

      this.Style_Dividers = val.Style_Dividers;
    }

    #endregion

    public bool Style_Dividers {
      get {
        return bool.Parse( this.GetElement( "Style_Dividers" ).InnerText );
      }
      set {
        this.Validate( "Style_Dividers" , value.ToString() );
      }
    }
  }
}
